#include "D3DTexture.h"
#include "../ISNW_Gui/ISNW_d3d/ISNW_d3d.h"
#include "D3DDriver.h"
#include "SceneManager.h"

namespace ISNW
{
namespace video
{
	bool D3DTexture::createtexturefromfile()
	{
		if(filename.size() == 0) return false;

		core::string fpath = scene::g_pSceneManager->getfs()->getfileincurrdir(filename.c_str());

		HRESULT hr = 
		D3DXCreateTextureFromFile(g_pdevice,fpath.c_str(),&texture);

		if(FAILED(hr))
		{
			fpath = scene::g_pSceneManager->getfs()->getfileinresourcedir(filename.c_str());

			hr = D3DXCreateTextureFromFile(g_pdevice,fpath.c_str(),&texture);
		}

		return (SUCCEEDED(hr));
	}

} // end namespace video
} // end namespace ISNW